var app = getApp();
var _that;
export default {
  init(page) {
    _that = page;
    const fixedDimensions = {
      buttonBounding: {
        height: 70,
        top: 88,
        width: 200
      },
      windowInfo: {
        containerTop: 173,
        height: 1334
      }
    };
    page.setData({
      buttonBounding: fixedDimensions.buttonBounding,
      windowInfo: fixedDimensions.windowInfo,
    });
    page.searchBindinput = this.searchBindinput;
    page.searchBindconfirm = this.searchBindconfirm;
    page.goSearch = this.goSearch;
    if (!page.goBack) {
      page.goBack = this.goBack;
    }
  },
  goBack() {
    wx.navigateBack({
      delta: 1,
    });
  },
  goSearch() {
    wx.hideKeyboard();
    _that.onSearch && _that.onSearch();
  },
  searchBindinput(e) {
    _that.setData({
      keyWord: e.detail.value,
    });
    _that.onSearch && _that.onSearch();
  },
  searchBindconfirm(e) {
    wx.hideKeyboard();
    _that.setData({
      keyWord: e.detail.value,
      loadingMoreHidden: true,
      list: [],
      pageNo: 1,
    });
    _that.onSearch && _that.onSearch();
  },
};
